export default class EventBus {
  constructor() {
    this.bus = {}
  }
  $on(eventType, callback) {
    this.bus[eventType] ? this.bus[eventType].push(callback) : (this.bus[eventType] = [callback])
  }
  $emit(eventType, ...args) {
    this.bus[eventType].forEach(callback => callback(...args))
  }
}